﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Portfolio.BL.Interfaces;
using Portfolio.Entities;
using Portfolio.Repository.Common;
using Portfolio.Repository.Menu;
using Portfolio.Repository.Interfaces;

namespace Portfolio.BL.Menu
{
    public class MenuTopBL : IMenuTopBL
    {
        private Portfolio3Entities _context = new Portfolio3Entities();

        private IList<MenuTopView> _menuTop;
        private MenuTopArticleV _articleByMenuItem;

        private IMenuRepository _menuRepository;                
            
        public MenuTopBL() { }

        public IList<MenuTopView> ReturnMenuTop()
        {
            _menuRepository = new MenuRepository(_context);
            _menuTop = _menuRepository.GetMenuItemsByActiveFlag();
            return _menuTop;           

        }


        public MenuTopArticleV ReturnArticleByMenuItem(int menuItemID)
        {
            _menuRepository = new MenuRepository(_context);
            _articleByMenuItem = _menuRepository.GetArticleByMenuItem(menuItemID);
            return _articleByMenuItem;
        }
    }
}
